/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Modulos;

import Cripto.AEMD;
import DB.DbLogin;

/**
 *
 * @author Dan dotcom
 */
public class Login {
    
    DbLogin log;
    
    public Login(String Usuario,String clave, String Get) throws Exception{
        
        AEMD aemd = new AEMD();
        String code = aemd.AEMD(clave);
        System.out.println(code+" codigo recivido");
        log = new DbLogin("select * from usuarios where nombre_Us='"+Usuario+"' AND key='"+code+"';",Get);
        if(!"".equals(log.oper))
        {
            System.out.println("Ha iniciado session");
        }
        else
        {
            System.out.println("Error al iniciar session");
        }
    }
    
    public static void main(String[] args) throws Exception {
        // TODO code application logic here
        String usuario="Dan dotcom",clave="123456", get="id_Us";
        Login bdi = new Login(usuario,clave,get);
        //clave: 123456, usuario: Dan dotcom / llave encriptada guardada en la base de datos: ad7b3cbb8f5f85f0c0895aed3cbd0acebe56e057f20f883e
    }
}